package com.gy.api;


import com.aaa.entity.OrderChargeItem;
import com.aaa.vo.Result;
import com.gy.service.OrderChargeService;
import com.gy.vo.ChargeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author GaoYa
 * @Date 2023/3/24 11:25
 * @Version 1.5
 * 收费列表模块
 */
@RestController
@RequestMapping("/charge/api/item")
public class OrderChargeController {

    /**
     * 注入方法
     */
    @Autowired
    private OrderChargeService orderChargeService;

    /**
     * 收费管理以及分页
     * @param current
     * @param size
     * @param chargeVo
     * @return
     */
    @PostMapping("/findAll/{current}/{size}")
    public Result findAll(
            @PathVariable Integer current,
            @PathVariable Integer size,
            @RequestBody ChargeVo chargeVo
            ){
       return orderChargeService.findAll(current, size,chargeVo);
    }


    /**
     * 查看订单详情
     * @param orderId
     * @return
     */
    @GetMapping("/findAllUserId/{orderId}")
    public Result<List<OrderChargeItem>> findAllUserId(@PathVariable String orderId){
        return orderChargeService.findAllUserId(orderId);
    }

    /**
     * 微信支付
     */
    @PostMapping("/payForItem/{orderId}")
    public Result payForItem(@PathVariable String orderId){
        return orderChargeService.payForItem(orderId);
    }


    /**
     * 现金支付
     * @param orderId
     * @return
     */
    @GetMapping("CashCharges/{orderId}")
    public Result<Integer> CashCharges(@PathVariable String orderId){
        return orderChargeService.CashCharges(orderId);
    }

}
